t = int(input())
for _ in range(t):
l, r = list(map(int, input().split()))
ans = 0
while l != 0 or r != 0:
ans += r-l
l = l//10
r = r//10
print(ans)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void pre() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
int cnt(int x) {
int ans = 0;
while (x) {
ans += x;
x /= 10;
}
return ans;
}
void solve() {
int l, r;
cin >> l >> r;
int ans = cnt(r) - cnt(l);
cout << ans << endl;
}
int main() {
pre();
int t;
cin >> t;
while (t--) {
solve();
}
}
1536C - Diluc and Kaeya | 1428C - ABBB |
1557A - Ezzat and Two Subsequences | 255A - Greg's Workout |
1059A - Cashier | 1389C - Good String |
1561A - Simply Strange Sort | 1337B - Kana and Dragon Quest game |
137C - History | 1443C - The Delivery Dilemma |
6C - Alice Bob and Chocolate | 1077C - Good Array |
285B - Find Marble | 6A - Triangle |
1729A - Two Elevators | 1729B - Decode String |
1729C - Jumping on Tiles | 1729E - Guess the Cycle Size |
553B - Kyoya and Permutation | 1729D - Friends and the Restaurant |
1606C - Banknotes | 580C - Kefa and Park |
342A - Xenia and Divisors | 1033A - King Escape |
39D - Cubical Planet | 1453A - Cancel the Trains |
645A - Amity Assessment | 1144A - Diverse Strings |
1553B - Reverse String | 1073A - Diverse Substring |